/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.me.stepapp.server;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Peter
 */
@Entity
@Table(name = "STEPAPP_LOCATION")
@NamedQueries({
    @NamedQuery(name = "StepappLocation.findAll", query = "SELECT s FROM StepappLocation s"),
    @NamedQuery(name = "StepappLocation.findById", query = "SELECT s FROM StepappLocation s WHERE s.id = :id"),
    @NamedQuery(name = "StepappLocation.findByTimestamp", query = "SELECT s FROM StepappLocation s WHERE s.timestamp = :timestamp"),
    @NamedQuery(name = "StepappLocation.findByLattitude", query = "SELECT s FROM StepappLocation s WHERE s.lattitude = :lattitude"),
    @NamedQuery(name = "StepappLocation.findByLongitude", query = "SELECT s FROM StepappLocation s WHERE s.longitude = :longitude")})
public class StepappLocation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "TIMESTAMP")
    private BigInteger timestamp;
    @Column(name = "LATTITUDE")
    private Double lattitude;
    @Column(name = "LONGITUDE")
    private Double longitude;
    @JoinTable(name = "STEPAPP_USER_STEPAPP_LOCATION", joinColumns = {
        @JoinColumn(name = "LOCATIONS_ID", referencedColumnName = "ID")}, inverseJoinColumns = {
        @JoinColumn(name = "USER_ID", referencedColumnName = "ID")})
    @ManyToMany
    private List<StepappUser> stepappUserList;

    public StepappLocation() {
    }

    public StepappLocation(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigInteger getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(BigInteger timestamp) {
        this.timestamp = timestamp;
    }

    public Double getLattitude() {
        return lattitude;
    }

    public void setLattitude(Double lattitude) {
        this.lattitude = lattitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public List<StepappUser> getStepappUserList() {
        return stepappUserList;
    }

    public void setStepappUserList(List<StepappUser> stepappUserList) {
        this.stepappUserList = stepappUserList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StepappLocation)) {
            return false;
        }
        StepappLocation other = (StepappLocation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.me.stepapp.server.StepappLocation[id=" + id + "]";
    }

}
